<?php

/**
 * This is the model class for table "sptpd_hotel".
 *
 * The followings are the available columns in table 'sptpd_hotel':
 * @property string $id_transaksi
 * @property string $nomor_urut
 * @property string $npwpd
 * @property string $nomor_sptdp
 * @property string $masa_pajak
 * @property string $masa_pajak_terbilang
 * @property string $tanggal_awal
 * @property string $tanggal_akhir
 * @property string $tahun_pajak
 * @property string $tanggal_sptpd
 * @property integer $kode_pajak
 * @property integer $id_rekening
 * @property string $no_rekening
 * @property string $cara_hitung
 * @property double $tarip_pajak
 * @property double $omzet_hotel
 * @property double $bunga_hotel
 * @property double $denda_hotel
 * @property double $total_pajak
 * @property string $tanggal
 * @property string $status_penetapan
 * @property string $status_bayar
 * @property string $status_aktif
 * @property string $keterangan
 * @property string $nomor_kohir
 * @property string $sptpd_stat
 * @property string $user_operator
 *
 * The followings are the available model relations:
 * @property Rekening $idRekening
 * @property Pajak $kodePajak
 * @property DataNpwpd $nomorUrut
 */
class SptpdHotel extends CActiveRecord
{
	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'sptpd_hotel';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('id_transaksi', 'required'),
			array('kode_pajak, id_rekening', 'numerical', 'integerOnly'=>true),
			array('tarip_pajak, omzet_hotel, bunga_hotel, denda_hotel, total_pajak', 'numerical'),
			array('id_transaksi, nomor_sptdp, nomor_kohir', 'length', 'max'=>25),
			array('nomor_urut', 'length', 'max'=>15),
			array('npwpd, no_rekening', 'length', 'max'=>20),
			array('masa_pajak, masa_pajak_terbilang, tahun_pajak', 'length', 'max'=>4),
			array('cara_hitung', 'length', 'max'=>5),
			array('status_penetapan, status_bayar, status_aktif, sptpd_stat', 'length', 'max'=>2),
			array('user_operator', 'length', 'max'=>35),
			array('tanggal_awal, tanggal_akhir, tanggal_sptpd, tanggal, keterangan', 'safe'),
			// The following rule is used by search().
			// @todo Please remove those attributes that should not be searched.
			array('id_transaksi, nomor_urut, npwpd, nomor_sptdp, masa_pajak, masa_pajak_terbilang, tanggal_awal, tanggal_akhir, tahun_pajak, tanggal_sptpd, kode_pajak, id_rekening, no_rekening, cara_hitung, tarip_pajak, omzet_hotel, bunga_hotel, denda_hotel, total_pajak, tanggal, status_penetapan, status_bayar, status_aktif, keterangan, nomor_kohir, sptpd_stat, user_operator', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'idRekening' => array(self::BELONGS_TO, 'Rekening', 'id_rekening'),
			'kodePajak' => array(self::BELONGS_TO, 'Pajak', 'kode_pajak'),
			'nomorUrut' => array(self::BELONGS_TO, 'DataNpwpd', 'nomor_urut'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id_transaksi' => 'Id Transaksi',
			'nomor_urut' => 'Nomor Urut',
			'npwpd' => 'Npwpd',
			'nomor_sptdp' => 'Nomor Sptdp',
			'masa_pajak' => 'Masa Pajak',
			'masa_pajak_terbilang' => 'Masa Pajak Terbilang',
			'tanggal_awal' => 'Tanggal Awal',
			'tanggal_akhir' => 'Tanggal Akhir',
			'tahun_pajak' => 'Tahun Pajak',
			'tanggal_sptpd' => 'Tanggal Sptpd',
			'kode_pajak' => 'Kode Pajak',
			'id_rekening' => 'Id Rekening',
			'no_rekening' => 'No Rekening',
			'cara_hitung' => 'Cara Hitung',
			'tarip_pajak' => 'Tarip Pajak',
			'omzet_hotel' => 'Omzet Hotel',
			'bunga_hotel' => 'Bunga Hotel',
			'denda_hotel' => 'Denda Hotel',
			'total_pajak' => 'Total Pajak',
			'tanggal' => 'Tanggal',
			'status_penetapan' => 'Status Penetapan',
			'status_bayar' => 'Status Bayar',
			'status_aktif' => 'Status Aktif',
			'keterangan' => 'Keterangan',
			'nomor_kohir' => 'Nomor Kohir',
			'sptpd_stat' => 'Sptpd Stat',
			'user_operator' => 'User Operator',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 *
	 * Typical usecase:
	 * - Initialize the model fields with values from filter form.
	 * - Execute this method to get CActiveDataProvider instance which will filter
	 * models according to data in model fields.
	 * - Pass data provider to CGridView, CListView or any similar widget.
	 *
	 * @return CActiveDataProvider the data provider that can return the models
	 * based on the search/filter conditions.
	 */
	public function search()
	{
		// @todo Please modify the following code to remove attributes that should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id_transaksi',$this->id_transaksi,true);
		$criteria->compare('nomor_urut',$this->nomor_urut,true);
		$criteria->compare('npwpd',$this->npwpd,true);
		$criteria->compare('nomor_sptdp',$this->nomor_sptdp,true);
		$criteria->compare('masa_pajak',$this->masa_pajak,true);
		$criteria->compare('masa_pajak_terbilang',$this->masa_pajak_terbilang,true);
		$criteria->compare('tanggal_awal',$this->tanggal_awal,true);
		$criteria->compare('tanggal_akhir',$this->tanggal_akhir,true);
		$criteria->compare('tahun_pajak',$this->tahun_pajak,true);
		$criteria->compare('tanggal_sptpd',$this->tanggal_sptpd,true);
		$criteria->compare('kode_pajak',$this->kode_pajak);
		$criteria->compare('id_rekening',$this->id_rekening);
		$criteria->compare('no_rekening',$this->no_rekening,true);
		$criteria->compare('cara_hitung',$this->cara_hitung,true);
		$criteria->compare('tarip_pajak',$this->tarip_pajak);
		$criteria->compare('omzet_hotel',$this->omzet_hotel);
		$criteria->compare('bunga_hotel',$this->bunga_hotel);
		$criteria->compare('denda_hotel',$this->denda_hotel);
		$criteria->compare('total_pajak',$this->total_pajak);
		$criteria->compare('tanggal',$this->tanggal,true);
		$criteria->compare('status_penetapan',$this->status_penetapan,true);
		$criteria->compare('status_bayar',$this->status_bayar,true);
		$criteria->compare('status_aktif',$this->status_aktif,true);
		$criteria->compare('keterangan',$this->keterangan,true);
		$criteria->compare('nomor_kohir',$this->nomor_kohir,true);
		$criteria->compare('sptpd_stat',$this->sptpd_stat,true);
		$criteria->compare('user_operator',$this->user_operator,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}

	/**
	 * Returns the static model of the specified AR class.
	 * Please note that you should have this exact method in all your CActiveRecord descendants!
	 * @param string $className active record class name.
	 * @return SptpdHotel the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}
}
